/*
 * Copyright (c) 2021 Old Dominion University. All rights reserved.
 *
 * See the NOTICE file(s) distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0
 *
 * SPDX-License-Identifier: EPL-2.0
 */

package org.eclipse.mosaic.fed.mqtt.message;

import org.eclipse.mosaic.fed.mqtt.constants.MqttTopic;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class MqttMessageFactoryTest {


    @Test
    public void testGetMqttMessage() {
        String message = "{\n" +
                "    \"id\": \"1\", \n" +
                "    \"type\": \"simple\", \n" +
                "    \"content\": \"nothing\"\n" +
                "}";

        SimpleMessage simple = (SimpleMessage) MqttMessageFactory.INSTANCE.getMqttMessage("simple", message);
        Assert.assertEquals(simple.getPayload().getContent(), "nothing");
    }

    @Test
    public void testGetTopic() {
        String topic = MqttTopic.MEC.getTopic("123");

        MqttMessageFactory.Type.fromTopic(topic);
    }
}
